import Vue from 'vue'
import { camelToKebab } from '@/utils'
import DafaLoading from '@/components/DafaLoading'
import DatetimePicker from '@/components/DatetimePicker'

import {Radio, RadioGroup, RadioButton, Badge, MessageBox, Message, Table, TableColumn, Loading, DropdownMenu, DatePicker, Input, Form, FormItem, Option, OptionGroup, Select, Button, Checkbox, CheckboxGroup, Dialog, Dropdown, DropdownItem, Pagination, Popover, MenuItem, Menu, Submenu, Tooltip } from 'element-ui'
const components = {
  // element-ui
  Badge,
  Table,
  TableColumn,
  DatePicker,
  Input,
  Form,
  FormItem,
  Option,
  OptionGroup,
  Select,
  Button,
  Radio,
  RadioGroup,
  RadioButton,
  Checkbox,
  CheckboxGroup,
  Dialog,
  Dropdown,
  DropdownItem,
  DropdownMenu,
  Pagination,
  Popover,
  Menu,
  Submenu,
  MenuItem,
  Tooltip
}
Vue.use(Loading.directive)
Vue.prototype.$msgbox = MessageBox
Vue.prototype.$message = Message

Vue.prototype.$loading = Loading.service
Object.values(components).forEach(i => Vue.use(i))

const component = {
  DafaLoading,
  DatetimePicker
}
Object.entries(component).forEach(([k, v]) => Vue.component(camelToKebab(k), v))
